*REPLICATION FILES FOR "REGULATING CONFLICT: HISTORICAL LEGACIES AND STATE COMMITMENT TO THE LAWS OF WAR"

version 12

*CD to appropriate directory

use "wallace_low_repdata.dta", clear


*FIGURE 1 - Support for Geneva Regime treaties over time.

*Create measure for total number of states supporting each treaty, by year
*Geneva
bys year: egen gen1949_support = total(ratdum_gen1949)
*AP1
bys year: egen ap1_support = total(ratdum_ap1)
*AP2
bys year: egen ap2_support = total(ratdum_ap2)

*Figure with number of States Party to Treaty with total number of states on top
twoway (line gen1949_support year if year>=1949 & year<=2000, sort lpattern(dash) lcolor(black)) ///
	(line ap1_support year if year>=1977 & year<=2000, sort lpattern(solid) lcolor(gs10)) ///
	(line ap2_support year if year>=1977 & year<=2000, sort lpattern(shortdash) lcolor(black)) ///
	(line numstate year if year>=1949 & year<=2000, sort lpattern(solid) lcolor(black)), ///
	ylabel( , grid) ytitle("Number of States") xtitle("Year") title("Support for the Geneva Conventions and Additional Protocols", size(medium)) ///
	legend(label(1 "Geneva Conventions") label(2 "Additional Protocol I") label(3 "Additional Protocol II") label(4 "Number of States in System")) ///
	scheme(s1mono)

 
 
*TABLE 1

*Declare data to be TSCS
tsset ccode year, yearly

*1949 Geneva Conventions
logit rat_gen1949 L.gen1949_gnorm L.gen1949_wbregnorm idegree100 ///
dem_new  polity2 communist ///
L.morrow10_av lngdp commonlaw mid_nowar_5y L.interwar_downes_num10 L.wdl10_downes ///
bratyears_gen1949 spline1_gen1949 spline2_gen1949 spline3_gen1949, vce(cluster ccode) nolog

*AP1
logit rat_ap1 L.ap1_gnorm L.ap1_wbregnorm idegree100 ///
dem_new polity2 communist leftgov2 ///
L.ipts_avg lngdp commonlaw rgdp96pc L.insurgency_num10 L.wdl10_insurgency ///
bratyears_ap1 spline1_ap1 spline2_ap1 spline3_ap1 , vce(cluster ccode) nolog

*AP2
logit rat_ap2 L.ap2_gnorm L.ap2_wbregnorm idegree100 ///
dem_new polity2 communist leftgov2 ///
L.ipts_avg commonlaw lngdp rgdp96pc L.civwar_ds_num10 L.wdl10_ds ///
bratyears_ap2 spline1_ap2 spline2_ap2 spline3_ap2 , vce(cluster ccode) nolog



*TABLE 2
*Geneva Conventions
estsimp logit rat_gen1949 L.gen1949_gnorm L.gen1949_wbregnorm idegree100 ///
dem_new polity2 communist ///
L.morrow10_av lngdp commonlaw mid_nowar_5y L.interwar_downes_num10 L.wdl10_downes ///
bratyears_gen1949 spline1_gen1949 spline2_gen1949 spline3_gen1949 , vce(cluster ccode)

*Baseline case
*Set all to mean
setx mean
*Set dichotomous to 0
setx (dem_new communist commonlaw) 0
*Simulate
simqi

*Calculate first difference for each variable reported in table
simqi fd(pr) changex(idegree100 p20 p80)
simqi fd(pr) changex(dem_new 0 1)
simqi fd(pr) changex(L.morrow10_av min max)
simqi fd(pr) changex(commonlaw 0 1)
simqi fd(pr) changex(L.interwar_downes_num10 min max)
simqi fd(pr) changex(L.wdl10_downes min max)
 

*API
estsimp logit rat_ap1 L.ap1_gnorm L.ap1_wbregnorm idegree100 ///
dem_new polity2 communist leftgov2 ///
L.ipts_avg lngdp commonlaw rgdp96pc L.insurgency_num10 L.wdl10_insurgency ///
bratyears_ap1 spline1_ap1 spline2_ap1 spline3_ap1 , vce(cluster ccode) dropsims

*Set all to mean
setx mean
*Set dichotomous to 0
setx (dem_new communist leftgov2 commonlaw) 0
*Simulate
simqi

simqi fd(pr) changex(idegree100 p20 p80)
simqi fd(pr) changex(dem_new 0 1)
simqi fd(pr) changex(leftgov2 0 1)
simqi fd(pr) changex(L.ipts_avg min max)
simqi fd(pr) changex(commonlaw 0 1)
simqi fd(pr) changex(L.insurgency_num10 min max)
simqi fd(pr) changex(L.wdl10_insurgency min max)

*APII
estsimp logit rat_ap2 L.ap2_gnorm L.ap2_wbregnorm idegree100 ///
dem_new polity2 communist leftgov2 ///
L.ipts_avg commonlaw lngdp rgdp96pc L.civwar_ds_num10 L.wdl10_ds ///
bratyears_ap2 spline1_ap2 spline2_ap2 spline3_ap2 , vce(cluster ccode) dropsims 

*Set all to mean
setx mean
*Set dichotomous to 0
setx (dem_new communist leftgov2 commonlaw) 0
*Simulate
simqi

simqi fd(pr) changex(idegree100 p20 p80)
simqi fd(pr) changex(dem_new 0 1)
simqi fd(pr) changex(leftgov2 0 1)
simqi fd(pr) changex(L.ipts_avg min max)
simqi fd(pr) changex(commonlaw 0 1)
simqi fd(pr) changex(L.civwar_ds_num10 min max)
simqi fd(pr) changex(L.wdl10_ds min max)




*ROBUSTNESS CHECKS


*USING COW REGIONAL IDENTIFIERS IN PLACE OF WORLD BANK IDENTIFIERS
*1949 Geneva Conventions
logit rat_gen1949 L.gen1949_gnorm L.gen1949_cowregnorm idegree100 ///
dem_new  polity2 communist ///
L.morrow10_av lngdp commonlaw mid_nowar_5y L.interwar_downes_num10 L.wdl10_downes ///
bratyears_gen1949 spline1_gen1949 spline2_gen1949 spline3_gen1949, vce(cluster ccode) nolog

*AP1
logit rat_ap1 L.ap1_gnorm L.ap1_cowregnorm idegree100 ///
dem_new polity2 communist leftgov2 ///
L.ipts_avg lngdp commonlaw rgdp96pc L.insurgency_num10 L.wdl10_insurgency ///
bratyears_ap1 spline1_ap1 spline2_ap1 spline3_ap1 , vce(cluster ccode) nolog

*AP2
logit rat_ap2 L.ap2_gnorm L.ap1_cowregnorm idegree100 ///
dem_new polity2 communist leftgov2 ///
L.ipts_avg commonlaw lngdp rgdp96pc L.civwar_ds_num10 L.wdl10_ds ///
bratyears_ap2 spline1_ap2 spline2_ap2 spline3_ap2 , vce(cluster ccode) nolog



*MODEL FOR GENEVA CONVENTION LIMITED ONLY TO COUNTRIES THAT RECENTLY EXPERIENCED WAR.
*Geneva
logit rat_gen1949 L.gen1949_gnorm L.gen1949_wbregnorm idegree100 ///
dem_new  polity2 communist ///
L.morrow10_av lngdp commonlaw mid_nowar_5y L.interwar_downes_num10 L.wdl10_downes ///
bratyears_gen1949 spline1_gen1949 spline2_gen1949 spline3_gen1949 if L.interwar_downes_num10!=0, vce(cluster ccode) nolog



*USING COMPLEMENTARY LOG-LOG ESTIMATOR IN PLACE OF LOGIT FOR MAIN MODELS
*complementary log-log is discrete data equivalent to the Cox proportional hazard model.
*1949 Geneva
cloglog rat_gen1949 L.gen1949_gnorm L.gen1949_wbregnorm idegree100 ///
dem_new  polity2 communist ///
L.morrow10_av lngdp commonlaw mid_nowar_5y L.interwar_downes_num10 L.wdl10_downes ///
bratyears_gen1949 spline1_gen1949 spline2_gen1949 spline3_gen1949, vce(cluster ccode) nolog

*AP1
cloglog rat_ap1 L.ap1_gnorm L.ap1_wbregnorm idegree100 ///
dem_new polity2 communist leftgov2 ///
L.ipts_avg lngdp commonlaw rgdp96pc L.insurgency_num10 L.wdl10_insurgency ///
bratyears_ap1 spline1_ap1 spline2_ap1 spline3_ap1 , vce(cluster ccode) nolog

*AP2
cloglog rat_ap2 L.ap2_gnorm L.ap2_wbregnorm idegree100 ///
dem_new polity2 communist leftgov2 ///
L.ipts_avg commonlaw lngdp rgdp96pc L.civwar_ds_num10 L.wdl10_ds ///
bratyears_ap2 spline1_ap2 spline2_ap2 spline3_ap2 , vce(cluster ccode) nolog



*RERUNNING MODEL FOR APII EXCLUDING VARIABLE FOR POLITICAL TERROR 
*Run AP2 model without Political Terror Scale to show how civil war participation increases in statistical significance (pg.163 fn.28).
logit rat_ap2 L.ap2_gnorm L.ap2_wbregnorm idegree100 ///
dem_new polity2 communist leftgov2 ///
/* "L.ipts_avg" excluded */ commonlaw lngdp rgdp96pc L.civwar_ds_num10 L.wdl10_ds ///
bratyears_ap2 spline1_ap2 spline2_ap2 spline3_ap2 , vce(cluster ccode) nolog



*INCLUDING A MEASURE FOR INTERNATIONAL NON-GOVERNMENTAL ORGANIZATIONS (INGOs) INTO API AND APII MODELS
*Models with the number of INGOs in a country, logged
logit rat_ap1 L.ap1_gnorm L.ap1_wbregnorm idegree100 ///
dem_new polity2 communist leftgov2 ///
L.ipts_avg lngdp commonlaw rgdp96pc L.insurgency_num10 L.wdl10_insurgency ///
lningo ///
bratyears_ap1 spline1_ap1 spline2_ap1 spline3_ap1 , vce(cluster ccode) nolog
*AP2
logit rat_ap2 L.ap2_gnorm L.ap2_wbregnorm idegree100 ///
dem_new polity2 communist leftgov2 ///
L.ipts_avg commonlaw lngdp rgdp96pc L.civwar_ds_num10 L.wdl10_ds ///
lningo ///
bratyears_ap2 spline1_ap2 spline2_ap2 spline3_ap2 , vce(cluster ccode) nolog

*Models with alternate measure of number of INGOs per capita
*AP1
logit rat_ap1 L.ap1_gnorm L.ap1_wbregnorm idegree100 ///
dem_new polity2 communist leftgov2 ///
L.ipts_avg lngdp commonlaw rgdp96pc L.insurgency_num10 L.wdl10_insurgency ///
ingo_percap ///
bratyears_ap1 spline1_ap1 spline2_ap1 spline3_ap1 , vce(cluster ccode) nolog
*AP2
logit rat_ap2 L.ap2_gnorm L.ap2_wbregnorm idegree100 ///
dem_new polity2 communist leftgov2 ///
L.ipts_avg commonlaw lngdp rgdp96pc L.civwar_ds_num10 L.wdl10_ds ///
ingo_percap ///
bratyears_ap2 spline1_ap2 spline2_ap2 spline3_ap2 , vce(cluster ccode) nolog



*MAIN MODELS USING CINC INSTEAD OF GDP
*Geneva 1949
logit rat_gen1949 L.gen1949_gnorm L.gen1949_wbregnorm idegree100 ///
dem_new  polity2 communist ///
L.morrow10_av cap commonlaw mid_nowar_5y L.interwar_downes_num10 L.wdl10_downes ///
bratyears_gen1949 spline1_gen1949 spline2_gen1949 spline3_gen1949, vce(cluster ccode) nolog

*AP1
logit rat_ap1 L.ap1_gnorm L.ap1_wbregnorm idegree100 ///
dem_new polity2 communist leftgov2 ///
L.ipts_avg cap commonlaw rgdp96pc L.insurgency_num10 L.wdl10_insurgency ///
bratyears_ap1 spline1_ap1 spline2_ap1 spline3_ap1 , vce(cluster ccode) nolog

*AP2
logit rat_ap2 L.ap2_gnorm L.ap2_wbregnorm idegree100 ///
dem_new polity2 communist leftgov2 ///
L.ipts_avg commonlaw cap rgdp96pc L.civwar_ds_num10 L.wdl10_ds ///
bratyears_ap2 spline1_ap2 spline2_ap2 spline3_ap2 , vce(cluster ccode) nolog



*USING PRIO LOW-LEVEL CONFLICT INDICATOR RATHER THAN GDP/CAPITA FOR API AND APII MODELS
*AP1
logit rat_ap1 L.ap1_gnorm L.ap1_wbregnorm idegree100 ///
dem_new polity2 communist leftgov2 ///
L.ipts_avg lngdp commonlaw civ_5y L.insurgency_num10 L.wdl10_insurgency ///
bratyears_ap1 spline1_ap1 spline2_ap1 spline3_ap1 , vce(cluster ccode) nolog

*AP2
logit rat_ap2 L.ap2_gnorm L.ap2_wbregnorm idegree100 ///
dem_new polity2 communist leftgov2 ///
L.ipts_avg commonlaw lngdp civ_5y L.civwar_ds_num10 L.wdl10_ds ///
bratyears_ap2 spline1_ap2 spline2_ap2 spline3_ap2 , vce(cluster ccode) nolog



*INCORPORATING RIVALRIES INTO GENEVA MODEL TO SEE IF ACCOUNT FOR WAR PARTICIPATION EFFECTS
*Thompson (2001) rivalry measure
logit rat_gen1949 L.gen1949_gnorm L.gen1949_wbregnorm idegree100 ///
dem_new  polity2 communist ///
L.morrow10_av lngdp commonlaw mid_nowar_5y L.interwar_downes_num10 L.wdl10_downes ///
trivalry_dum ///
bratyears_gen1949 spline1_gen1949 spline2_gen1949 spline3_gen1949, vce(cluster ccode) nolog

*Alternate Goertz and Diehl (200) rivalry measure
logit rat_gen1949 L.gen1949_gnorm L.gen1949_wbregnorm idegree100 ///
dem_new  polity2 communist ///
L.morrow10_av lngdp commonlaw mid_nowar_5y L.interwar_downes_num10 L.wdl10_downes ///
gdrivalry2_dum ///
bratyears_gen1949 spline1_gen1949 spline2_gen1949 spline3_gen1949, vce(cluster ccode) nolog



*MAIN MODELS USING A CONTINUOUS-TIME COX PROPORTIONAL HAZARD MODEL.
*Stata does not allow the use of time-series operators for Cox models, so need to lag the following variables.
sort ccode year
by ccode: gen gen1949_gnorm_lag = gen1949_gnorm[_n-1]
by ccode: gen gen1949_wbregnorm_lag = gen1949_wbregnorm[_n-1]
by ccode: gen morrow10_av_lag = morrow10_av[_n-1]
by ccode: gen interwar_downes_num10_lag = interwar_downes_num10[_n-1]
by ccode: gen wdl10_downes_lag = wdl10_downes[_n-1]
by ccode: gen ap1_gnorm_lag = ap1_gnorm[_n-1]
by ccode: gen ap1_wbregnorm_lag = ap1_wbregnorm[_n-1]
by ccode: gen ipts_avg_lag = ipts_avg[_n-1]
by ccode: gen insurgency_num10_lag = insurgency_num10[_n-1]
by ccode: gen wdl10_insurgency_lag = wdl10_insurgency[_n-1]
by ccode: gen ap2_gnorm_lag = ap2_gnorm[_n-1]
by ccode: gen ap2_wbregnorm_lag = ap2_wbregnorm[_n-1]
by ccode: gen civwar_ds_num10_lag = civwar_ds_num10[_n-1]
by ccode: gen wdl10_ds_lag = wdl10_ds[_n-1]

*Coding a months-to-failure variable needed for the continuous-time event history analysis.
*Generate date version of COW independence data
tostring cowsys, replace
gen cowsysdate = date(cowsys, "YMD")
format cowsysdate %td

*1949 Geneva Conventions
*Geneva 1949 opened for ratification August 1949
gen geneva_motofail = 0 
replace geneva_motofail = . if bratyears_gen1949==.
*Include "+4" because treaty opened for ratification in August of first year (8th month).
replace geneva_motofail = 12*bratyears_gen1949 + 4 if rat_gen1949==0 & successor_gen1949==0
replace geneva_motofail = 12*bratyears_gen1949 + 4 - 12 + month(ratdate_gen1949) if rat_gen1949==1 & successor_gen1949==0
*For states that enter sample in later year because achieve independence post-1977
replace geneva_motofail = 12*bratyears_gen1949 + (12 - month(cowsysdate)) if rat_gen1949==0 & successor_gen1949==1
replace geneva_motofail = 12*bratyears_gen1949 + (12 - month(cowsysdate)) - 12 + month(ratdate_gen1949) if rat_gen1949==1 & successor_gen1949==1
*Recode negative or 0 numbers to 1 for estimation purposes
sum geneva_motofail
replace geneva_motofail = 1 if geneva_motofail<=0 & geneva_motofail!=.
sum geneva_motofail
*Cox model
stset geneva_motofail, fail(rat_gen1949) id(ccode)
stcox gen1949_gnorm_lag gen1949_wbregnorm_lag idegree100 ///
	dem_new polity2 communist ///
	morrow10_av_lag lngdp commonlaw mid_nowar_5y interwar_downes_num10_lag wdl10_downes_lag, ///
	vce(cluster ccode) nolog efron nohr

*1977 Additional Protocol I
gen ap1_motofail = 0
replace ap1_motofail = . if bratyears_ap1==.
*For first year include "+6" because opened for ratification in June.
replace ap1_motofail = 12*bratyears_ap1 + 6 if rat_ap1==0 & successor_ap==0
replace ap1_motofail = 12*bratyears_ap1 + 6 - 12 + month(ratdate_ap1) if rat_ap1==1 & successor_ap==0
*For successor states not in sample at start of ratification period
replace ap1_motofail = 12*bratyears_ap1 + (12 - month(cowsysdate)) if rat_ap1==0 & successor_ap==1
replace ap1_motofail = 12*bratyears_ap1 + (12 - month(cowsysdate)) - 12 + month(ratdate_ap1) if rat_ap1==1 & successor_ap==1
*Recode negative or 0 numbers to 1 for estimation purposes
sum ap1_motofail
replace ap1_motofail = 1 if ap1_motofail<=0 & ap1_motofail!=.
*Cox model
stset ap1_motofail, fail(rat_ap1) id(ccode)
stcox ap1_gnorm_lag ap1_wbregnorm_lag idegree100 ///
	dem_new polity2 communist leftgov2 ///
	ipts_avg_lag lngdp commonlaw rgdp96pc insurgency_num10_lag wdl10_insurgency_lag, ///
	vce(cluster ccode) nohr efron nolog

*1977 Additional Protocol II
gen ap2_motofail = 0
replace ap2_motofail = . if bratyears_ap2==.
*For first year include "+6" because opened for ratification in June.
replace ap2_motofail = 12*bratyears_ap2 + 6 if rat_ap2==0 & successor_ap==0
replace ap2_motofail = 12*bratyears_ap2 + 6 - 12 + month(ratdate_ap2) if rat_ap2==1 & successor_ap==0
*For successor states not in sample at start of ratification period
replace ap2_motofail = 12*bratyears_ap2 + (12 - month(cowsysdate)) if rat_ap2==0 & successor_ap==1
replace ap2_motofail = 12*bratyears_ap2 + (12 - month(cowsysdate)) - 12 + month(ratdate_ap2) if rat_ap2==1 & successor_ap==1
*Recode negative or 0 numbers to 1 for estimation purposes
sum ap2_motofail
replace ap2_motofail = 1 if ap2_motofail<=0 & ap2_motofail!=.
*Cox model
stset ap2_motofail, fail(rat_ap2) id(ccode)
stcox ap2_gnorm_lag ap2_wbregnorm_lag idegree100 ///
	dem_new polity2 communist leftgov2 ///
	ipts_avg_lag lngdp commonlaw rgdp96pc civwar_ds_num10_lag wdl10_ds_lag, ///
	vce(cluster ccode) nohr efron nolog
